package demo1;

import java.util.Scanner;

public class Circle {
    int r;//定义半径

    //计算面积
    public void getArea(int r){
        System.out.println("面积"+Math.PI*r*r);
    }
    //计算周长
    public void getPerimeter(int r){

        System.out.println( "周长"+Math.PI*r*2);

    }


    public static void main(String[] args) {
        Circle circle=new Circle();//创建圆的对象
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入圆的半径");
        int r = scanner.nextInt();//得到半径
        circle.getArea(r);
        circle.getPerimeter(r);
    }
}
